Let us show you how a little script writing can reduce a lot of busywork for graphic artists.
Chuck Weger
Leave the repetitive tasks to your Mac by using AppleScript, so you can get back to the more creative aspects of graphic-arts work. With this plain-English programming language, you can automate the time-consuming steps involved in such tasks as processing incoming scans, compiling catalogs, and moving printed documents to the World Wide Web. And because AppleScript works with many popular applications, you can very likely create your scripts by using applications you already have.
Here's a brief overview of AppleScript and some ideas on how to use it to streamline common graphic-arts processes.
What Is AppleScript?
AppleScript is a programming language that's both simple enough for nonprogrammers to learn (see the sample code in the "Photoshop Image Manipulation" figure) and flexible enough to perform pretty much any task users can with a keyboard. And it's ideal for taking over repetitive tasks while you're doing something else.
Some people think of AppleScript as a high-powered macro language, similar to QuicKeys or Tempo. But an AppleScript script can do more than select a menu item or click on a dialog-box button; it can manipulate many of a document's parts (called objects), such as fields in a database, paragraphs in a document, or values in a spreadsheet. Not only can AppleScript outdo a macro program but it can also outperform a user at a keyboard. That's because it can access properties of a document the user can't see (the name of a text box in QuarkXPress, for instance). A script can also be more methodical than even the most careful user at checking details.
Supporting Cast
AppleScript doesn't work alone. Part of what makes it so powerful is that it can manipulate one or many applications (on one or more Macs). So you can automate an entire job, whether it requires using a database application, a page-layout program, or a utility.
Unfortunately, not all applications are scriptable. For those programs that aren't, there's help: PreFab Player, from PreFab Software, lets you script the unscriptable (see the "Must-Haves" sidebar and the "Photoshop Image Manipulation" figure). Still, you can do the best scripting with programs that give you full scripting capability. Here's the lowdown on what you can expect from some representative publishing-program favorites:
QuarkXPress.
QuarkXPress was one of the earliest and best supporters of AppleScript (it even shipped with a run-time version of another scripting language, UserLand's Frontier). Hundreds of complex routines have been developed with QuarkXPress as a base, partly because of its scriptability. Even some Quark XTensions (for example, XCatalog, from Em Software) are scriptable.
Adobe Photoshop.
Adobe has been notably late to the scripting party, with only Fetch (inherited from Aldus) and some of the Prepress Division tools (ditto) being scriptable. Photoshop, an application that would benefit dramatically from scripting, continues to lack it. You can use PreFab Player as a workaround for creating scripts in Photoshop, but it's not as powerful as a scriptable version of Photoshop would be.
FileMaker and Cumulus.
Two database programs heavily used in graphic arts -- Claris FileMaker Pro, for text, and Canto Cumulus, for images and other media assets -- are both scriptable. You can use them in concert with AppleScript to perform publishing tasks that require accessing or storing data.
Apple Media Tool.
Even Apple, long dormant in the area of scripting, is back in the act. The newest release of Apple Media Tool is not only scriptable but it's also recordable, meaning that you can record a series of actions into a script rather than write the script from scratch.
Suitcase.
For those of us who live in a font swamp -- creating, loading, and unloading font suitcases -- there's good news: Suitcase 3.0, from Symantec, is also AppleScript-savvy.
Working Scripts
Here are some specific situations in which an AppleScript script or two can offload a good chunk of your repetitive work:
Preflight.
The process of checking files for correctness before they're output to film or plate is a prime example of time-consuming, repetitive work. You can use an AppleScript script with Luminous' Color Central to take over the checking of resolutions and color palettes and also to make sure a file includes the right graphics.
Desktop Color Separation (DCS).
Wherever the same set of operations must be performed on many files, such as in DCS, you should think scripting. For example, you could automate the creation of DCS files with Photoshop and PreFab Player and the e-mailing of the low-res master file to clients with Eudora or Claris Emailer.
Image input.
Another good use for AppleScript is in the acquisition of images from a scanner or digital camera (using Cumulus) and then the transformation of those images. To transform them, you could write a script that would instruct Photoshop to apply color separation, change resolution, and rotate them.
Cataloging images.
Scripts are particularly useful when coupled with databases for performing such tasks as storing tagged images. Each step in this common procedure, which involves the manipulation of Photoshop files, can be performed through scripting: Move Photoshop files onto a server, using the Finder; resample them with Color Central to generate a low-res file for OPI (Open Prepress Interface) use; catalog them with Cumulus; and tag the cataloged images with information (such as a photo source or a product code) from a corporate FileMaker database.
Database publishing.
Scripts and databases are also useful in repetitive types of publishing, such as creating product catalogs. You can, for instance, automate the use of information from a FileMaker product database in order to create a page layout in QuarkXPress and then the copying of product shots from a Cumulus database into the layout (see the "Saving Time with AppleScript" figure).
Finding fonts.
AppleScript can also do something as simple yet time-consuming as checking for fonts. Using Suitcase and AppleScript, a service bureau can automate the process of analyzing an incoming file for required fonts and then locating and loading them.
How to Learn Scripting
There isn't room in this article to teach you everything you need to know to take advantage of AppleScript. But we can point you toward the best books on the topic plus some crucial online resources (see the "AppleScript Library" sidebar).
You won't really get AppleScript until you start scripting yourself, though. The best way to learn is by copying -- er, shall we say, emulating -- someone else's work. Grab a script that works, and start playing with it. You can find a wide variety of scripts online (see the "Must-Haves" sidebar) or simply use the sample script that's posted on MacUser's FTP site (ftp://ftp.zdnet.com/macuser/graphic-artist-script.hqx), which automates the conversion of spot color to process color in QuarkXPress. (Be sure to download the accompanying read-me file and the file Jon's Commands as well.) And remember: You can't break anything, as long as you steer clear of dangerous commands such as the Finder's Delete command.
The Future of AppleScript
If you put in the time to learn AppleScript, can you rest assured that you haven't wasted your efforts on a technology without a future? Fortunately, AppleScript's future looks bright. Besides the benefits graphic artists can reap, those who frequent the World Wide Web have plenty to celebrate. There's a host of new scriptable applications -- from mail client software such as Eudora and Claris Emailer to browsers such as Netscape Navigator and server software such as WebSTAR. Using AppleScript is one of the best ways to automate Internet-related work, including retrieving and filing mail. It's also the simplest way to develop CGI (Common Gateway Interface) programs, those little gnomes that live on Web servers and help generate forms, databases, and interactive Web pages.
The reception by the user community has been welcoming, and Apple is showing renewed interest. AppleScript is slated for in-clusion in Copland and is scheduled to be PowerPC-native by the time you read this. With the support of the larger community of users taking advantage of it in order to streamline their work, AppleScript will help ensure that the Mac continues to be the best platform for getting real work done.
Chuck Weger is a MacUser contributing editor.
Must-Haves / software for serious scripters
Why be satisfied with creating average scripts? Here's a list of software that will give you more scripting power, ranging from making scripts easier to use to helping you learn how to script:
FaceSpan.
This is an interface builder that lets you build windows, dialog boxes, and menus for your scripts. Use it to make projects look and feel like other Mac applications. Software Designs Unlimited, 919-968-4567.
PreFab Player.
Many applications (Photoshop, for example) aren't yet scriptable. PreFab Player lets you write scripts for those applications. It simulates such actions as making menu selections, clicking on dialog-box buttons, and just about anything users can do under script control. PreFab Software, 617-628-9025.
Scripting additions.
Commonly called OSAX (after the file type -- the plural is OSAXen), these are plug-ins that extend AppleScript by adding new commands and new data types. There are hundreds of them, they're all shareware, and most can be obtained from ScriptWeb (http://www.scriptweb.com/scriptweb/). Some popular additions include ACME Script Widgets, Jon's Commands, GTQ Scripting Library, and Script Tools.
Sal's AppleScript Snippets.
This is a collection of QuarkXPress unlocked sample scripts (scripts with viewable code) written by Sal Soghoian, one of the world's leading QuarkXPress scripters. Call the vendor, XChange (800-788-7557 or 970-225-2484), for this inexpensive ($39) and useful learning tool, or download it from Sal's Web page (http://users.aol.com/nyhthawk/welcome.html).
Script editors
For those who outgrow the script editor that comes with AppleScript, there are three commercial products that do more in terms of editing, debugging, and general utility tasks. Scripter (Main Event Software, 202-298-9595) is perhaps the most comprehensive. It's great for beginners exploring scripting terminology. Another good script editor is Script Debugger (Late Night Software, 604-929-5578), which is fast and functional. Last, there's ScriptWizard (Full Moon Software, 800-232-1560 or 510-843-6485).
Photoshop Image Manipulation
Does this process look familiar? If you feel as though you could do it in your sleep, you'll be glad to know that AppleScript can do it for you while you sleep -- even though Photoshop isn't scriptable out of the box. By using an application called PreFab Player (see the "Must-Haves" sidebar), you can write easy, English-like AppleScript code that simulates menu selections such as these in Photoshop and in other nonscriptable applications. (You can download the actual script for this process from MacUser's FTP site at ftp://ftp.zdnet.com/macuser/graphic-artist-script2.hqx.)
1. Original image
2. Resizing
3. Sharpening
4. Mode changing
5. Final image
The AppleScript Library
There's no shortage of places to read about AppleScript. Here are some popular ones:
Books
Goodman, Danny. Danny Goodman's AppleScript Handbook. Second edition. New York: Random House, 1994. If you get just one AppleScript resource, make it this book. It's comprehensive; tough reading in parts, but everything's there.
Schneider, Derrick. The Tao of AppleScript. Second edition. Indianapolis: Hayden Books/BMUG, 1994. A kinder, gentler alternative to the Goodman book. This may be an easier read for those who have no programming experience.
Michel, Steve. Scripting the Scriptable Finder. Pleasant Hill, CA: Heizer Publishing, 1995. A thin but information-packed book. Most of the material in here is in Goodman's book somewhere, but you may be able to find it more easily in this guide. Call 510-943-7667 to get it.
Trinko, Tom. Applied Mac Scripting. New York: M&T Books, 1995. A mammoth work that covers both AppleScript and Frontier scripting.
Online Resources
All the major online services have forums devoted to scripting, and many vendors, such as Quark and Claris, have forums with scripting sections. But the best resources are on the Web. Point your browser at http://www.scriptweb.com/scriptweb/.
Saving Time with AppleScript
Any repetitive process that has many steps, including one that involves using multiple applications, is an excellent candidate for a time-saving script. AppleScript's ability to manipulate objects across the boundary of separate applications makes using it a great way to automate processes such as searching for images and related text in separate databases and putting them together in a layout.
Steps for a task without AppleScript:
* Open QuarkXPress layout, FileMaker Pro database, and Cumulus database.
* Search for image in Cumulus database.
* If you find multiple images, determine the correct one by checking information such as most recent date or image source.
* Drag and drop image into QuarkXPress.
* Switch to FileMaker Pro.
* Search for text related to image.
* Cut and paste text into QuarkXPress.
* Edit text as needed in QuarkXPress.
* Return to step 2 and repeat remaining steps for next image.
Steps for the same task with AppleScript:
* First time only: Create an AppleScript script that performs the steps for this task.
* Double-click on the script icon.
* Come back to Mac when the script has finished running, and edit results in QuarkXPress as needed.